package org.aicfve.solarangle.controller;


import com.hava.web.MediaType;
import org.aicfve.previze.solar.entity.SolarAngle;
import org.aicfve.solarangle.entity.SolarAngleRequestObject;
import org.aicfve.solarangle.service.SolarAngleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value="rest/solar-angle")
public class SolarAngleRestController {

    @Autowired
    SolarAngleService solarAngleService;

    @RequestMapping(method = RequestMethod.POST, consumes = MediaType.JSON)
    public SolarAngle compute(@RequestBody SolarAngleRequestObject object){
        return this.solarAngleService.compute(object.getDate(),object.getCoordinate(),object.getTimezone());
    }
}
